<html>
<head><meta charset="utf-8"><title>emacs and rust-mode integration · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20and.20rust-mode.20integration.html">emacs and rust-mode integration</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="182803548"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20and%20rust-mode%20integration/near/182803548" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20and.20rust-mode.20integration.html#182803548">(Dec 06 2019 at 20:54)</a>:</h4>
<p>So I've been tweaking my rust-mode configuration but i'm hitting some problems integrating rust-analyzer that I don't quite understand. For some reason, it seems like <code>M-x lsp</code> now wants to run rls instead of rust-analyzer. <span class="user-mention" data-user-id="129457">@Florian Diebold</span> maybe you have some clue why?</p>
<p>This is my .emacs file right now:</p>
<div class="codehilite"><pre><span></span>(defun niko-rust-mode-hook ()
  (camelCase-mode 1)
  (lsp)
  )

(defun niko-setup-rust-mode ()
    (straight-use-package
     &#39;(rust-mode :type git :host github :repo &quot;rust-lang/rust-mode&quot;))
    (add-hook &#39;rust-mode-hook &#39;niko-rust-mode-hook)
    (require &#39;rust-mode)
    (require &#39;ra-emacs-lsp)
    )
(niko-setup-rust-mode)
</pre></div>



<a name="182803559"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20and%20rust-mode%20integration/near/182803559" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20and.20rust-mode.20integration.html#182803559">(Dec 06 2019 at 20:54)</a>:</h4>
<p>feel free to tell me some more elegant way to do things...</p>



<a name="182803580"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20and%20rust-mode%20integration/near/182803580" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20and.20rust-mode.20integration.html#182803580">(Dec 06 2019 at 20:54)</a>:</h4>
<p>If I run things with <code>C-u M-x lsp</code> and select rust-analyzer, everything seems to work ok</p>



<a name="182803635"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20and%20rust-mode%20integration/near/182803635" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20and.20rust-mode.20integration.html#182803635">(Dec 06 2019 at 20:55)</a>:</h4>
<p>actually I think I just encountered the same problem after I upgraded lsp-mode -- try <code>(setq lsp-rust-server 'rust-analyzer)</code> during setup</p>



<a name="182803763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20and%20rust-mode%20integration/near/182803763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20and.20rust-mode.20integration.html#182803763">(Dec 06 2019 at 20:56)</a>:</h4>
<p>lsp-mode now comes with RA support</p>



<a name="182803780"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20and%20rust-mode%20integration/near/182803780" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20and.20rust-mode.20integration.html#182803780">(Dec 06 2019 at 20:56)</a>:</h4>
<p>do I no longer need ra-emacs-lsp?</p>



<a name="182803782"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20and%20rust-mode%20integration/near/182803782" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20and.20rust-mode.20integration.html#182803782">(Dec 06 2019 at 20:56)</a>:</h4>
<p>ah well I guess it has other keybindings</p>



<a name="182803786"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20and%20rust-mode%20integration/near/182803786" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20and.20rust-mode.20integration.html#182803786">(Dec 06 2019 at 20:56)</a>:</h4>
<p>though tbh I always forget to use those</p>



<a name="182803794"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20and%20rust-mode%20integration/near/182803794" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20and.20rust-mode.20integration.html#182803794">(Dec 06 2019 at 20:56)</a>:</h4>
<p>I guess not, though I don't know whether they integrated everything</p>



<a name="182803839"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20and%20rust-mode%20integration/near/182803839" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20and.20rust-mode.20integration.html#182803839">(Dec 06 2019 at 20:57)</a>:</h4>
<p>well, that seems to work anyway</p>



<a name="182803866"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20and%20rust-mode%20integration/near/182803866" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20and.20rust-mode.20integration.html#182803866">(Dec 06 2019 at 20:57)</a>:</h4>
<p>I had some other weird problem I don't understand</p>



<a name="182803890"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20and%20rust-mode%20integration/near/182803890" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20and.20rust-mode.20integration.html#182803890">(Dec 06 2019 at 20:57)</a>:</h4>
<p>where I had a <code>chalk-2</code> directory</p>



<a name="182803904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20and%20rust-mode%20integration/near/182803904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20and.20rust-mode.20integration.html#182803904">(Dec 06 2019 at 20:57)</a>:</h4>
<p>and lsp kept looking for <code>~/versioned/chalk</code></p>



<a name="182803913"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20and%20rust-mode%20integration/near/182803913" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20and.20rust-mode.20integration.html#182803913">(Dec 06 2019 at 20:57)</a>:</h4>
<p>I eventually just renamed the directory :P</p>



<a name="182803922"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20and%20rust-mode%20integration/near/182803922" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20and.20rust-mode.20integration.html#182803922">(Dec 06 2019 at 20:57)</a>:</h4>
<p>I have no idea where it was getting that from...</p>



<a name="182803931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20and%20rust-mode%20integration/near/182803931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20and.20rust-mode.20integration.html#182803931">(Dec 06 2019 at 20:57)</a>:</h4>
<p>but I guess that's not related to rust-analyzer</p>



<a name="182803936"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20and%20rust-mode%20integration/near/182803936" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20and.20rust-mode.20integration.html#182803936">(Dec 06 2019 at 20:57)</a>:</h4>
<p>huh, yeah that's weird</p>



<a name="182803988"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20and%20rust-mode%20integration/near/182803988" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20and.20rust-mode.20integration.html#182803988">(Dec 06 2019 at 20:58)</a>:</h4>
<p>I think maybe when I did <code>git clone</code> I called it chalk and then renamed it to chalk-2? not sure</p>



<a name="182803993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20and%20rust-mode%20integration/near/182803993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20and.20rust-mode.20integration.html#182803993">(Dec 06 2019 at 20:58)</a>:</h4>
<p>chalk-1 seems to work ok :)</p>



<a name="183469195"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20and%20rust-mode%20integration/near/183469195" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mark-i-m <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20and.20rust-mode.20integration.html#183469195">(Dec 15 2019 at 02:59)</a>:</h4>
<p>Perhaps the bug is in the use of emacs rather than vim? (:P)</p>



<a name="183479765"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20and%20rust-mode%20integration/near/183479765" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20and.20rust-mode.20integration.html#183479765">(Dec 15 2019 at 08:58)</a>:</h4>
<p>You mean evil mode, right?</p>



<a name="183795106"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/emacs%20and%20rust-mode%20integration/near/183795106" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mark-i-m <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/emacs.20and.20rust-mode.20integration.html#183795106">(Dec 18 2019 at 22:02)</a>:</h4>
<p>No, I mean emacs is the bug</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>